package exams.list;

import java.util.Arrays;

public class ListNodeUtilsSolutionTest {

    final static ListNodeUtilsSolution listNodeUtilsSolution = new ListNodeUtilsSolution();

    public static void main(String[] args) {
        ListNode head = new ListNode(5);
        int n = appendListNode(head, 5, 6, 5, 5);

        int[] res = listNodeUtilsSolution.convert(head, n);
        System.out.println(Arrays.toString(res));
    }

    public static int appendListNode(ListNode node, int... vals) {
        int i =0;
        for(; i < vals.length; i++) {
            node.next = new ListNode(vals[i]);
            node = node.next;
        }
        return i + 1;
    }

}
